package com.letv.whatslive.common.utils;

/**
 * 操作日志工具类
 * Created by wangjian7 on 2016/3/4.
 */
public class OperateLogUtils {

    //日志文件名
    public static final String FILE_NAME = "operateLog";

    //观看操作
    public static final String OPTION_WATCH = "watch";

    //点赞操作
    public static final String OPTION_LIKE = "like";

    //评论操作
    public static final String OPTION_COMMENT = "comment";

    //分享操作
    public static final String OPTION_SHARE = "share";

    //操作日志版本号
    private static String VERSION = "1";

    //字段分隔符
    private static String SEPARATOR = ",";


    public static String getLogString(Long time, String option, String watcherId, String userId, String programId){
        StringBuffer log = new StringBuffer().append(time).append(SEPARATOR).append(option).append(SEPARATOR)
                .append(VERSION).append(SEPARATOR).append(watcherId).append(SEPARATOR).append(userId).append(SEPARATOR)
                .append(programId).append(SEPARATOR).append(1);
        return log.toString();
    }

    public static String getLogString(Long time, String option, String watcherId, String userId, String programId, int repeat){
        StringBuffer log = new StringBuffer().append(time).append(SEPARATOR).append(option).append(SEPARATOR)
                .append(VERSION).append(SEPARATOR).append(watcherId).append(SEPARATOR).append(userId).append(SEPARATOR)
                .append(programId).append(SEPARATOR).append(repeat);
        return log.toString();
    }

}
